const isAnagram = (s, t) => {
    const sArr = s.split('');
    const tArr = t.split('');
    const sortFn = (a, b) => {
        return a.charCodeAt() - b.charCodeAt();
    };
    sArr.sort(sortFn);
    tArr.sort(sortFn);
    return sArr.join('') === tArr.join('');
};

var a = isAnagram('abcq','bca')
console.log(a);
